<%--                                                                       --%>
<%-- Copyright (c) 2001-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %>

<script language=JavaScript>

function confirmDeleteMicrosite()
{
  if (confirm("<bean:message key="cs.confirm.delete.microsite"/>")) {
    return true;
  }
  else {
    return false;
  }
}

function onClickSetDefaultMicrosite() {
  document.micrositeListForm.action = '<c:url value="/cs/setDefaultMicrosite.do"/>';
  document.micrositeListForm.action=url;
  document.micrositeListForm.submit();
}

function clickNew(theForm, url) {
  theForm.action = url;
  theForm.submit();
}

</script>


<html:form action="/cs/setDefaultMicrosite.do" method="get">
<!-- Zone 5 starts here.  -->
<table class="zoneFive" width="98%" align="center" border="0" cellspacing="0" cellpadding="0" 
         summary="microsite index page">
  <tr>
    <td valign="top">
    
    <div class="app_pageSubtitle">
      <span class="left">
        <bean:message key="ep.microsite.index.title" arg0='${micrositeListView.map.templateName}'/>
        </span>
      <span class="right">
        <c:if test="${micrositeListView.map.canCreateMicrosite}">
          <c:url var="wizardUrl" value="/cs/microsite/msNew.do"/>
          <input type="button" class="titleButton" name="newBtn"
                 value='<bean:message key="button.createNew"/>' 
                 onclick='return clickNew(this.form, "<c:out value="${wizardUrl}"/>");'>
              <%-- add urlParams --%>
        </c:if>
      </span>
    </div>
    <br>
    <div>
      <b>
       <bean:message key="ep.set.microsite.homepage" 
            arg0="${micrositeListView.map.templateName}"/>: 
 
        <input type="hidden" name="templateId" value='<c:out value="${micrositeListView.map.templateId}"/>' > 
        
        <select name="defaultMicrositeId" size="1" value="${micrositeListForm.map.defaultMicrositeId}">
           <c:if test="${micrositeListForm.map.defaultMicrositeId == 0}">
             <option value="0" selected>
           </c:if>
           <c:if test="${micrositeListForm.map.defaultMicrositeId != 0}">
             <option value="0">
           </c:if>
             
             <c:out value="${micrositeListView.map.templateName}"/>&nbsp;<bean:message key="cs.index"/>
           </option>
           
           <c:forEach var="aMicro" items="${micrositeListView.map.micrositeList}" varStatus="index">
              <c:if test="${aMicro.map.id == micrositeListForm.map.defaultMicrositeId}">
               <option value='<c:out value="${aMicro.map.id}"/>' selected>
                 <c:out value="${aMicro.map.name}"/>
               </option> 
             </c:if>
             <c:if test="${aMicro.map.id != micrositeListForm.map.defaultMicrositeId}">
             <option value='<c:out value="${aMicro.map.id}"/>'>
                <c:out value="${aMicro.map.name}"/>
             </option> 
             </c:if>          
         </c:forEach>      
        </select>
        
        <input type="submit" name="setBtn" class="titleButton" value='<bean:message key="button.set"/>'/>
        
        <%--
        <a href="javascript:onClickSetDefaultMicrosite();">
          <html:img page="/cs/images/buttons/global/gbtn_set.gif" width="33" height="18" 
                altKey="cs.image.alt.set" border="0"/>
        </a>
        
        --%>
  </b>
    </div>
    
    <!--end title bar here-->

 	<br>
    <!-- Start List here -->
    <table class="dataTable" border="0" cellspacing="1" cellpadding="2" 
           summary="microsite list table" width="100%">
     <tr class="listHeader"> 
     
     <c:if test="${micrositeListView.map.showOwner}">
       <td id="Name" valign="top" width="18%"><bean:message key="cs.name"/></td>
       <td id="desc" valign="top" width="46%"><bean:message key="cs.description"/></td>
       <td id="owner" valign="top" width="20%"><bean:message key="cs.owner"/></td>
       <td id="Action" valign="middle" width="16%"><bean:message key="cs.actions"/></td>
       
       <%-- calculate column widths --%>
       <c:set var="width_col_1" value="18%" scope="page" />
       <c:set var="width_col_2" value="46%" scope="page" />
       <c:set var="width_col_3" value="20%" scope="page" />
       <c:set var="width_col_4" value="16%" scope="page" />
         
      </c:if>
     
     <c:if test="${!micrositeListView.map.showOwner}">
       <td id="Name" valign="top" width="28%"><bean:message key="cs.name"/></td>
       <td id="desc" valign="top" width="56%"><bean:message key="cs.description"/></td>
       <td id="Action" valign="middle" width="16%"><bean:message key="cs.actions"/></td>
       
       <c:set var="width_col_1" value="28%" scope="page" />
       <c:set var="width_col_2" value="56%" scope="page" />
       <c:set var="width_col_3" value="0%" scope="page" />
       <c:set var="width_col_4" value="16%" scope="page" />
       
     </c:if>
     
     </tr>
      
      <!--start main content area here-->
 <c:forEach var="microsite" items="${micrositeListView.map.micrositeList}" varStatus="status" >

    <c:if test="${status.count%2 == 0}">
      <c:set var="classVar" value="listEven" scope="page" />
    </c:if>
    <c:if test="${status.count%2 != 0}">
      <c:set var="classVar" value="listOdd" scope="page" />
    </c:if>
    
    <tr class='<c:out value="${classVar}"/>' > 
      <td headers="Name" valign="top" width='<c:out value="${width_col_1}"/>'><b>
      <c:url var="viewUrl" value="${micrositeListView.map.scriptPath}">
        <c:param name="micrositeId" value="${microsite.map.id}"/>
        <c:param name="currentPhaseId" value="-1"/>
        <c:param name="currentAction" value="home"/>
      </c:url>
      
      <a href='<c:out value="${viewUrl}"/>'>
          <c:out value="${microsite.map.name}"/>
      </a></b></td>
      <td headers="desc" valign="top" width='<c:out value="${width_col_2}"/>'>
        <c:out value="${microsite.map.description}"/> &nbsp;
      </td>
      
      <c:if test="${micrositeListView.map.showOwner}">
      <td headers="owner" valign="top" width='<c:out value="${width_col_3}"/>'>
        <c:forEach var="ownerName" items="${microsite.map.ownerNameList}" varStatus="index">
           <c:if test="${index.count == 1}">
             <c:out value="${ownerName}"/>
           </c:if>
          <c:if test="${index.count != 1}">
            ,&nbsp;
            <c:out value="${ownerName}"/>
          </c:if>  
        </c:forEach>
        
      </td>
      </c:if>
      <td headers="Action" valign="top" width='<c:out value="${width_col_4}"/>' nowrap align="left">
        <c:if test="${microsite.map.isOwner}">
         <c:url var="editUrl" value="/cs/micrositeEdit.do">
           <c:param name="micrositeId" value="${microsite.map.id}"/>
           <c:param name="currentPhaseId" value="-1"/>
           <c:param name="currentAction" value="home"/>
         </c:url>
         <a href='<c:out value="${editUrl}"/>'><html:img page="/cs/images/action/icon_edit.gif" styleClass="actionIcon" altKey="cs.image.alt.edit" titleKey="cs.image.alt.edit" border="0"/></a> 
         <c:url var="deleteUrl" value="/cs/micrositeDelete.do">
           <c:param name="micrositeId" value="${microsite.map.id}"/>
           <c:param name="currentPhaseId" value="-1"/>
           <c:param name="currentAction" value="home"/>
           <c:param name="templateId" value="${micrositeListForm.map.templateId}"/>
         </c:url>
         <a href='<c:out value="${deleteUrl}"/>' onclick="return confirmDeleteMicrosite()"><html:img page="/cs/images/action/icon_delete.gif" styleClass="actionIcon" altKey="cs.image.alt.delete" titleKey="cs.image.alt.delete" border="0"/></a>
        </c:if>
      </td>
    </tr>
</c:forEach>
  </table>
	<br>  
  </html:form>
	<!--end main content area here-->


